package com.icehand.payment.admin.v1.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.icehand.common.dto.PageDto;
import com.icehand.common.result.BizResult;
import com.icehand.common.result.PageResult;
import com.icehand.mybatis.payment.domain.App;
import com.icehand.mybatis.payment.mapper.AppChannelMapper;
import com.icehand.mybatis.payment.mapper.AppMapper;
import com.icehand.payment.admin.v1.service.AdminPayServiceV1;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author icehand
 */
@Slf4j
@Service
public class AdminPayServiceImplV1 implements AdminPayServiceV1 {
    private final AppMapper appMapper;
    private final AppChannelMapper appChannelMapper;

    @Autowired
    public AdminPayServiceImplV1(AppMapper appMapper,AppChannelMapper appChannelMapper) {
        this.appMapper = appMapper;
        this.appChannelMapper = appChannelMapper;
    }

    @Override
    public BizResult getApps(PageDto pageDto) {
        Page<App> page = new Page<>(pageDto.getPage(),pageDto.getSize());
        page.setRecords(appMapper.selectList(null));
        PageResult<App> pageResult = new PageResult<>();
        pageResult.setTotal(page.getTotal());
        return new BizResult<>(pageResult);
    }

    @Override
    public BizResult getPayChannelsByAppId(Integer payAppId) {

        return null;
    }

}
